package main
import (
	"fmt"
	"unsafe"
)

// 4. 类型
// bool
// 数字类型
	// int8, int16, int32, int64, int
	// uint8, uint16, uint32, uint64, uint
	// float32, float64
	// complex64, complex128
	// byte
	// rune
// string
func main(){
	// bool类型 布尔值 true false
	a1 := true
	b1 := false
	c1 := a1 && b1
	d1 := a1 || b1 
	fmt.Println("a1==",a1,"b1==",b1,"c1==",c1,"d1==",d1)

	// int
	var a2 int = 89
	b2 := 98
	fmt.Println("a2==",a2,"b2==",b2)
	fmt.Printf("\ntype a2 is %T, size is %d", a2, unsafe.Sizeof(a2))
	fmt.Printf("\ntype b2 is %T, size is %d", b2, unsafe.Sizeof(b2))

	// float
	a3, b3 := 12.3, 45.6
	fmt.Printf("\ntype: a3- %T b3- %T", a3, b3)
	sum := a3 + b3
	diff := a3 - b3
	fmt.Println("\nsum=",sum,"diff=",diff)

	// 复数类型
	c4 := complex(5, 7)
	d4 := 8 + 27i
	cadd4 := c4 + d4
	cmul4 := c4 * d4
	fmt.Println("cadd4=",cadd4,"cmul4=",cmul4)


	// string
	first := "yanghao "
	last := "hao"
	name := first + last
	fmt.Println("name=",name)

	// 类型转换
	num1 := 11
	num2 := 22.22
	// num3 := num1 + num2	//报错 不同类型不可以添加
	sum3 := float64(num1) + num2
	fmt.Println("sum3=",sum3)





}